package com.zbkj.service.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zbkj.common.model.client.discovery.Discovery;
import com.zbkj.common.response.client.DiscoveryListResponse;
import com.zbkj.service.dao.client.DiscoveryDao;
import com.zbkj.service.service.DiscoveryService;
import org.springframework.stereotype.Service;

@Service
public class DiscoveryServiceImpl extends ServiceImpl<DiscoveryDao, Discovery> implements DiscoveryService {

    @Override
    public IPage<Discovery> getDiscoveryPage(int page, int pageSize) {
        Page<Discovery> pageObj = new Page<>(page, pageSize);
        return this.lambdaQuery()
                .eq(Discovery::getIsDel, 0)
                .orderByAsc(Discovery::getSort)
                .page(pageObj);
    }

    @Override
    public IPage<DiscoveryListResponse> getDiscoveryPageWithContacts(int page, int pageSize, Integer userId) {
        Page<DiscoveryListResponse> pageObj = new Page<>(page, pageSize);
        return baseMapper.selectDiscoveryPageWithContacts(pageObj, userId);
    }

    @Override
    public DiscoveryListResponse getDetailWithContacts(Integer id, Integer userId) {
        return baseMapper.selectDetailWithContacts(id, userId);
    }
} 